/**
 * @class   IModemDslListener
 * @brief   Interface for ModemDsl callbacks (events).
 *
 * @see     ModemDslImpl
 * @see     wosh::devices::ModemDslBundle
 ****************************************************************************
 * @version 0.8.467 $Id: IModemDslListener.h 2866 2010-08-07 15:01:48Z alex $
 * @author  Alessandro Polo
 * @date    Released on 2009-06-04
 ****************************************************************************/
/* Copyright (c) 2007-2010, WOSH - Wide Open Smart Home 
 * by Alessandro Polo - OpenSmartHome.com
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of the OpenSmartHome.com WOSH nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY Alessandro Polo ''AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL Alessandro Polo BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ****************************************************************************/

#ifndef __WOSH_DEVICES_IModemDslListener_H__
 #define __WOSH_DEVICES_IModemDslListener_H__

 #include <interfaces/devices/Modem.h>

struct pppStats
 {
	unsigned long rx_packets;		///< This is for RX LED/TX PACKETS INFO
	unsigned long rx_errors;		///< Shows how many erros has ocurred on receive
	double rx_bytes;				///< How many bytes has received
	// ---------------------------------------------------------------------
	unsigned long tx_packets;		///< This is for TX LED/TX PACKETS INFO
	unsigned long tx_errors;		///< Shows how many erros has ocurred on transmition
	double tx_bytes;				///< How many Bytes has sent
	// -------------------- COMPARATION-VARIABLES ----------------------------
	unsigned long rx_packets_comp; 
	unsigned long tx_packets_comp; 
	double rx_bytes_comp;
	double tx_bytes_comp;
	// ---------------------------------------------------------------------
	unsigned long connect_time;		///< epoc
	unsigned long current_time;		///< epoc
	float top_speed;				///< top (ever) speed in Kb/s
	float curr_speed;				///< last measured speed in Kb/s
	// ---------------------------------------------------------------------
	int online;						///< 1=online, 0=offline
	// ---------------------------------------------------------------------
	char *ip_addr_rtrn;
	// ---------------------------------------------------------------------
	unsigned long online_time_span;	///< current_time - connect_time (seconds)
	// ---------------------------------------------------------------------
	unsigned long online_days;		///< connected from - days
	int online_hour;				///< connected from - hours
	int online_min;					///< connected from - min
	int online_sec;					///< connected from - sec
};


class ModemDslImpl;

class IModemDslListener
 {
	public:
		/**
		 * @brief   Callback event, called when connection status changes
		 * @param modem [out] the ModemDsl instance which raise the event
		 * @param state [in] the new connection state
		 * @see    ModemDsl::connect()
		 * @see    ModemDsl::disconnect()
		 * @see    ModemDsl::reconnect()
		 * @see    ModemDsl::checkConnected()
		 */
		virtual void modem_ConnectionState( ModemDslImpl* modem, wosh::interfaces::devices::Modem::CONNECTION_STATE state ) = 0;

		/**
		 * @brief   Callback event, called periodically when stats have been updated.
		 * @param modem [out] the ModemDsl instance which raise the event
		 * @param stats [out] last available stats (points to internal reference)
		 * @see   autoRefreshFrequency
		 */
		virtual void modem_StatsUpdate( ModemDslImpl* modem, const pppStats& stats ) = 0;

	public:
		virtual ~IModemDslListener() { }

}; // class def


#endif //__WOSH_DEVICES_IModemDslListener_H__
